package com.mc.designpattern.strategy.service;

import com.mc.designpattern.strategy.channelStrategy.ChannelStrategy;
import com.mc.designpattern.strategy.util.Channel;
import com.mc.designpattern.strategy.util.HandleChannelContext;
import com.mc.designpattern.strategy.util.HandleChannelProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/***
 * @ClassName OrderChannelService
 * @Description todo
 * @Author CC
 * @Date: 2019/10/3012:18
 * @Version 1.0
 */
@Service
public class OrderChannelService implements IOrderChannelService {
    @Autowired
    private HandleChannelContext channelContext;
    @Override
    public void handleChannel(Channel channel) {
        //第一种方式
        final ChannelStrategy strategy = channelContext.getStrategy(channel.getType());
        strategy.handleOrder(channel);
    }
}
